package ypmits.components.listbox.view {
	import ypmits.components.util.TextFieldUtility;
	import ypmits.font.Arial;

	import flash.display.Sprite;

	/**
	 * @author Dave Lenz
	 */
	public class ListBoxWarning extends Sprite {

		private var textfield : TextFieldUtility;
		private var extraspace : int = 4;
		private var horizontalfactor : Number = 1.3;

		
		
		public function ListBoxWarning()
		{
			addChild( textfield = new TextFieldUtility( "", new Arial( ).fontName, 12, 0xFFFFFF, true ) );
			textfield.x = extraspace * horizontalfactor;
			textfield.y = extraspace;
			redraw( );
			
			alpha = 0;
			visible = false;
		}

		
		
		public function setText( text : String ) : void 
		{
			textfield.text = text;
			
			redraw( );
		}

		
		
		private function redraw() : void 
		{
			graphics.clear();
			graphics.beginFill( 0, .8 );
			graphics.drawRoundRect( 0, 0, textfield.width + ((extraspace * 2) * horizontalfactor), textfield.height + (extraspace * 2), 10 );
			graphics.endFill( );
		}

		
		
		public function show() : void 
		{
			alpha = 1;
			visible = true;
		}

		
		
		public function hide() : void 
		{
			alpha = 0;
			visible = false;
		}
	}
}
